/**
 * Copyright (c) 2007,中企动力华南研发中心<br>
 * All rights reserved.<br>
 */
package com.ce.pms.custservice.web;

import com.ce.pms.base.web.PmsBaseAction;
import com.ce.pms.custservice.service.IEventManageService;
import com.ce.pms.custservice.service.ISignReadingService;
import com.ce.pms.custservice.vo.SignReadingRecordVO;
import com.ce.pms.system.custservice.service.ISignReadingRuleService;
import com.sitechasia.webx.core.annotation.Out;
import com.sitechasia.webx.core.annotation.Read;

/**
 * 功能描述：<br>
 * @author 易贤建 创建日期：2008-12-22<br>
 */
public class SignReadingAction extends PmsBaseAction {

	private ISignReadingService signReadingService = null;
	/**
	 * 客户事件Service
	 */
	private IEventManageService eventManageService;
	/**
	 * 功能描述:初始化阅签主页面<br>
	 * @param custEventid
	 * @return
	 * Create author:yixianjian <br>
	 * Create on:2008-12-22  <br>
	 */
	public String initMain(@Read(key="custEventid")
						   @Out(key="custEventid")Long custEventid){
		return "main";
	}
	/**
	 * 功能描述:  <br>
	 * @param custEventid
	 * @return
	 * Create author:yixianjian <br>
	 * Create on:2008-12-23  <br>
	 */
	public String initAddSignReading(@Read(key="custEventid")
			   								@Out(key="custEventid")Long custEventid){
		return "add";
	}
	/**
	 * 功能描述:初始化阅签意见页面<br>
	 * @param custEventid 客服事件ID
	 * @return
	 * Create author:yixianjian <br>
	 */
	public String initSignReadingDetail(@Read(key="custEventid") Long custEventid){
		SignReadingRecordVO vo = signReadingService.getSignReadingByID(custEventid);
		setAttribute("signReadingVO", vo);
		return "detail";
	}
	/**
	 * 功能描述: 添加领导阅签<br>
	 * @param signReadingRecordVO
	 * @return
	 * Create author:yixianjian <br>
	 * Create on:2008-12-23  <br>
	 */
	public String noteAddSignReading(@Read @Out SignReadingRecordVO signReadingVO){
		signReadingVO.setReviewer(super.getUsername());
		signReadingVO.setCreator(super.getUserId());
		signReadingService.addSignReading(signReadingVO.getCustomerServiceEventID(), signReadingVO);
		return "add";
	}
	/**
	 * 功能描述:判断是否允许阅签<br>
	 * @param custEventid
	 * Create author:yixianjian <br>
	 * Create on:2009-1-5  <br>
	 */
	public void validationAllowSignReading(@Read(key="custEventid") Long custEventid){
		eventManageService.isAllowReadView(custEventid);
	}
	public void setSignReadingService(ISignReadingService signReadingService) {
		this.signReadingService = signReadingService;
	}
	public void setEventManageService(IEventManageService eventManageService) {
		this.eventManageService = eventManageService;
	}
}
